#include "Body.h"

#include "Render/Shader.h"
#include "Core/Application.h"
#include "Render/Render.h"
#include "Character.h"

Body::Body()
{
	shader_body = new Shader("assets/shaders/body.vs", "assets/shaders/body.frag");
}

Body::~Body()
{
}

void Body::BeginPlay()
{

}

void Body::Tick(double DetaTime)
{

}

void Body::Destroyed()
{
}

void Body::RenderActor()
{
	//*Target = Location;

	Camera* camera = ((Character*)Root)->GetCamera();
	glm::mat4 projection = camera->GetProjectionMatrix(camera->Zoom, (float)Application::Get().GetWindow().GetWidth() / (float)Application::Get().GetWindow().GetHeight(), 0.1f, 1000.0f);
	glm::mat4 view = camera->GetViewMatrix();
	glm::mat4 model = glm::mat4(1.0f);

	shader_body->use();
	shader_body->setMat4("projection", projection);
	shader_body->setMat4("view", view);
	shader_body->setVec3("bodyColor", glm::vec3(0.0f, 1.0f, 0.0f));

	model = GetTransformMatrix();
	shader_body->setMat4("model", model);
	Render::renderCube();
	//std::cout << "Location x: " << Location.x << " y: " << Location.y << " z: " << Location.z << std::endl;
	//std::cout << "Target x: " << Target->x << " y: " << Target->y << " z: " << Target->z << std::endl;


	Super::RenderActor();

}

void Body::OnEvent(double DetaTime)
{
}

void Body::OnMouse(double xoffset, double yoffset)
{
}
